home *** CD-ROM | disk | FTP | other *** search
- using System;
- using System.Drawing;
- using System.Collections;
- using System.ComponentModel;
- using System.Windows.Forms;
-
- namespace DiskWriter
- {
- /// <summary>
- /// Summary description for frmErase.
- /// </summary>
- public class frmErase : System.Windows.Forms.Form
- {
- internal System.Windows.Forms.RadioButton eraseQuickOpt;
- internal System.Windows.Forms.RadioButton eraseFullOpt;
- internal System.Windows.Forms.Button EraseBtn;
- internal System.Windows.Forms.ProgressBar ProgressBar1;
- bool quickErase;
- bool EraseInProgress;
- public Form1 frm;
- /// <summary>
- /// Required designer variable.
- /// </summary>
- private System.ComponentModel.Container components = null;
-
- public frmErase()
- {
- //
- // Required for Windows Form Designer support
- //
- InitializeComponent();
- quickErase = true;
- EraseInProgress = false;
-
- //
- // TODO: Add any constructor code after InitializeComponent call
- //
- }
-
- /// <summary>
- /// Clean up any resources being used.
- /// </summary>
- protected override void Dispose( bool disposing )
- {
- if( disposing )
- {
- if(components != null)
- {
- components.Dispose();
- }
- }
- base.Dispose( disposing );
- }
-
- #region Windows Form Designer generated code
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- private void InitializeComponent()
- {
- this.eraseQuickOpt = new System.Windows.Forms.RadioButton();
- this.eraseFullOpt = new System.Windows.Forms.RadioButton();
- this.EraseBtn = new System.Windows.Forms.Button();
- this.ProgressBar1 = new System.Windows.Forms.ProgressBar();
- this.SuspendLayout();
- //
- // eraseQuickOpt
- //
- this.eraseQuickOpt.Checked = true;
- this.eraseQuickOpt.Location = new System.Drawing.Point(8, 8);
- this.eraseQuickOpt.Name = "eraseQuickOpt";
- this.eraseQuickOpt.Size = new System.Drawing.Size(149, 19);
- this.eraseQuickOpt.TabIndex = 1;
- this.eraseQuickOpt.TabStop = true;
- this.eraseQuickOpt.Text = "Quick Erase (TOC Only)";
- this.eraseQuickOpt.CheckedChanged += new System.EventHandler(this.eraseQuickOpt_CheckedChanged);
- //
- // eraseFullOpt
- //
- this.eraseFullOpt.Location = new System.Drawing.Point(8, 32);
- this.eraseFullOpt.Name = "eraseFullOpt";
- this.eraseFullOpt.Size = new System.Drawing.Size(150, 19);
- this.eraseFullOpt.TabIndex = 2;
- this.eraseFullOpt.Text = "Full Erase";
- this.eraseFullOpt.CheckedChanged += new System.EventHandler(this.eraseFullOpt_CheckedChanged);
- //
- // EraseBtn
- //
- this.EraseBtn.Location = new System.Drawing.Point(160, 8);
- this.EraseBtn.Name = "EraseBtn";
- this.EraseBtn.Size = new System.Drawing.Size(91, 18);
- this.EraseBtn.TabIndex = 3;
- this.EraseBtn.Text = "Erase";
- this.EraseBtn.Click += new System.EventHandler(this.EraseBtn_Click);
- //
- // ProgressBar1
- //
- this.ProgressBar1.Location = new System.Drawing.Point(0, 56);
- this.ProgressBar1.Name = "ProgressBar1";
- this.ProgressBar1.Size = new System.Drawing.Size(256, 12);
- this.ProgressBar1.TabIndex = 5;
- //
- // frmErase
- //
- this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
- this.ClientSize = new System.Drawing.Size(256, 77);
- this.Controls.AddRange(new System.Windows.Forms.Control[] {
- this.ProgressBar1,
- this.EraseBtn,
- this.eraseFullOpt,
- this.eraseQuickOpt});
- this.MaximizeBox = false;
- this.MinimizeBox = false;
- this.Name = "frmErase";
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
- this.Text = "frmErase";
- this.Load += new System.EventHandler(this.frmErase_Load);
- this.ResumeLayout(false);
-
- }
- #endregion
-
- private void eraseQuickOpt_CheckedChanged(object sender, System.EventArgs e)
- {
- quickErase = true;
- }
-
- private void eraseFullOpt_CheckedChanged(object sender, System.EventArgs e)
- {
- quickErase = false;
- }
-
- private void EraseBtn_Click(object sender, System.EventArgs e)
- {
- EraseBtn.Enabled = false;
-
- frm.err = false;
- EraseInProgress = true;
- this.Refresh();
- frm.DataCDWriter1.Erase(true);
- if( frm.err == true )
- {
- StopErase();
- frm.err = false;
- this.Hide();
- }
-
- while( frm.eraseProgress < 100 )
- {
- Application.DoEvents();
- if( frm.OperationProgress == true )
- {
- ProgressBar1.Value = frm.eraseProgress;
- }
- frm.OperationProgress = false;
- Application.DoEvents();
- }
- frm.eraseProgress = 100;
- ProgressBar1.Value = frm.eraseProgress;
- MessageBox.Show("Erase Complete!");
- StopErase();
- }
-
- private void frmErase_Load(object sender, System.EventArgs e)
- {
- frm = (Form1)this.Owner;
- quickErase = true;
- EraseInProgress = false;
- }
-
- private void StopErase()
- {
- EraseInProgress = false;
- EraseBtn.Enabled = true;
- ProgressBar1.Value = 0;
- frm.RefreshDiskInfo();
- frm.err = false;
- this.Hide();
- }
-
- }
- }
-